/** 表格表头 */
export const tableColumns = (t: (msg: string) => string) => [
  {
    prop: "id",
    type: "selection",
    label: t("table.selection"),
    width: 55,
    reserveSelection: true,
    fixed: "left",
  },
  {
    prop: "username",
    label: "用户信息",
    width: 220,
    fixed: "left",
  },
  {
    prop: "time_length",
    label: "上课时长",
    minWidth: 100,
  },
  {
    prop: "is_over",
    label: "完播情况",
    minWidth: 100,
  },
  {
    prop: "hongbao_status",
    label: "红包状态",
    minWidth: 100,
  },
  {
    prop: "store_name",
    label: "归属门店",
    minWidth: 160,
  },
  {
    prop: "share_user",
    label: "邀请人",
    minWidth: 100,
  },
  {
    prop: "share_num",
    label: "邀请人数",
    minWidth: 100,
  },
  {
    prop: "daoke_times",
    label: "到课次数",
    minWidth: 100,
  },
  {
    prop: "wanbo_times",
    label: "结果",
    minWidth: 140,
  },
  {
    prop: "money",
    label: "红包总额",
    minWidth: 100,
    format: (val: string) => {
      return Number(val) === 0 ? "--" : val;
    },
  },
  {
    prop: "jifen",
    label: "积分数量",
    minWidth: 100,
  },
  {
    prop: "mobile",
    label: "手机号码",
    minWidth: 100,
  },
  {
    prop: "qun_total",
    label: "在群状态",
    minWidth: 100,
    format: (val: any) => {
      return "未知";
    },
  },
  {
    prop: "relation_total",
    label: "好友状态",
    minWidth: 100,
    format: (val: any) => {
      return "未知";
    },
  },
  {
    prop: "action",
    label: t("table.operation"),
    width: 200,
    showOverflowTooltip: false,
    fixed: "right",
  },
];

/** 表格搜索表单 */
export const tableSearchFormItems = (t: (msg: string) => string) => [
  {
    attrs: {
      label: "用户信息",
      prop: "search_key",
    },
    value: {
      value: "",
      select: "2",
    },
    component: {
      is: "f-input",
      props: {
        placeholder: "请输入用户信息",
        selectOptions: {
          props: {
            style: {
              width: "80px",
            },
          },
          options: [
            {
              label: "精确",
              value: "1",
            },
            {
              label: "模糊",
              value: "2",
            },
          ],
        },
      },
    },
  },
  {
    attrs: {
      label: "手机号",
      prop: "mobile",
    },
    value: "",
    component: {
      is: "el-input",
      props: {
        placeholder: "请输入手机号",
      },
    },
  },
  {
    attrs: {
      label: "归属门店",
      prop: "store_id",
    },
    value: "",
    component: {
      is: "el-select",
      props: {
        placeholder: "请输入归属门店",
        filterable: true,
      },
    },
    childrenComponent: {
      is: "el-option",
      children: [],
    },
  },
  {
    attrs: {
      label: "完播情况",
      prop: "wanke_status",
    },
    value: "",
    component: {
      is: "el-select",
      props: {
        placeholder: "请选择完播情况",
      },
    },
    childrenComponent: {
      is: "el-option",
      children: () => [
        {
          label: "未完播",
          value: "1",
        },
        {
          label: "已完播",
          value: "2",
        },
      ],
    },
  },
  {
    attrs: {
      label: "答题情况",
      prop: "dati_status",
    },
    value: "",
    component: {
      is: "el-select",
      props: {
        placeholder: "请选择答题情况",
      },
    },
    childrenComponent: {
      is: "el-option",
      children: () => [
        {
          label: "已答题",
          value: "1",
        },
        {
          label: "未答题",
          value: "2",
        },
      ],
    },
  },
  {
    attrs: {
      label: "红包情况",
      prop: "is_right",
    },
    value: "",
    component: {
      is: "el-select",
      props: {
        placeholder: "请选择红包情况",
      },
    },
    childrenComponent: {
      is: "el-option",
      children: () => [
        {
          label: "已获得红包",
          value: "1",
        },
        {
          label: "未获得红包",
          value: "0",
        }
      ],
    },
  },
  {
    attrs: {
      label: "领取情况",
      prop: "hongbao_status",
    },
    value: "",
    component: {
      is: "el-select",
      props: {
        placeholder: "请选择领取情况",
      },
    },
    childrenComponent: {
      is: "el-option",
      children: () => [
        {
          label: "已领取红包",
          value: "1",
        },
        {
          label: "未领取红包",
          value: "3",
        },
        {
          label: "领取失败",
          value: "2",
        },
      ],
    },
  },
  {
    attrs: {
      label: "积分情况",
      prop: "jifen_status",
    },
    value: "",
    component: {
      is: "el-select",
      props: {
        placeholder: "请选择积分情况",
      },
    },
    childrenComponent: {
      is: "el-option",
      children: () => [
        {
          label: "已获得积分",
          value: "1",
        },
        {
          label: "未获得积分",
          value: "2",
        },
      ],
    },
  },
  {
    attrs: {
      label: "学习时长",
      prop: "time_length",
    },
    value: [],
    component: {
      is: "f-input-range",
    },
  },
];
